import React, {lazy} from "react";
import {Navigate} from "react-router-dom";

// 懒加载组件
const Main = lazy(() => import("@/page/Main"));
const SystemUser = lazy(() => import("@/page/System/User"));
const UserInfo = lazy(() => import("@/page/User/Info"));
const ToyHome = lazy(() => import("@/page/Toy/Home"));
const PhotographyShowcase = lazy(() => import("@/page/Home/newIndex"));

export const businessRouter = [
  {
    path: "/main",
    element: () => <Main />,
    name: "main",
    meta: {
      icon: "HomeFilled",
      title: "首页",
      isLink: "",
      isHide: false,
      isFull: false,
      isAffix: false,
      isKeepAlive: true
    }
  },
  {
    path: "/photography",
    element: () => <PhotographyShowcase />,
    name: "photography",
    meta: {
      icon: "CameraFilled",
      title: "风光摄影",
      isLink: "",
      isHide: false,
      isFull: true,
      isAffix: false,
      isKeepAlive: true
    }
  },
  {
    path: "/toy",
    name: "toy",
    element: <Navigate to={"/toy/manage"} />,
    meta: {
      icon: "HomeFilled",
      title: "玩具説明書",
      isLink: "",
      isHide: false,
      isFull: false,
      isAffix: false,
      isKeepAlive: true
    },
    children: [
      {
        path: "/toy/manage",
        element: () => <ToyHome />,
        name: "toyHome",
        meta: {
          icon: "HomeFilled",
          title: "玩具説明書",
          isLink: "",
          isHide: false,
          isFull: false,
          isAffix: false,
          isKeepAlive: true
        }
      }
    ]
  },
  {
    path: "/system",
    name: "system",
    element: <Navigate to={"/system/user"} />,
    meta: {
      icon: "HomeFilled",
      title: "系统",
      isLink: "",
      isHide: false,
      isFull: false,
      isAffix: false,
      isKeepAlive: true
    },
    children: [
      {
        path: "/system/user",
        element: () => <SystemUser />,
        name: "systemUser",
        meta: {
          icon: "HomeFilled",
          title: "用户管理",
          isLink: "",
          isHide: false,
          isFull: false,
          isAffix: false,
          isKeepAlive: true
        }
      }
    ]
  },
  {
    path: "/user",
    name: "user",
    meta: {
      icon: "HomeFilled",
      title: "用户相关",
      isLink: "",
      isHide: true,
      isFull: false,
      isAffix: false,
      isKeepAlive: true
    },
    children: [
      {
        path: "/user/info",
        name: "user",
        element: () => <UserInfo />,
        meta: {
          icon: "HomeFilled",
          title: "用户",
          isLink: "",
          isHide: true,
          isFull: false,
          isAffix: false,
          isKeepAlive: true
        }
      }
    ]
  }
];
